home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / MacII / H-L / JuliaSet 5.1b0.cpt / JuliaSet.a next >
Text File  |  1988-04-08  |  21KB  |  852 lines

  1. ;
  2. ;    fractal xcmd v0.3 -- Doug Felt, Oct 14, 1987
  3. ;    
  4. ;    This draws a fractal on the screen.  Not to the card, yet.  Function is
  5. ;    f(z) = z * z + c, julia set mapped to 4 patterns.
  6. ;    
  7. ;    Format:
  8. ;         Fractal seed.h seed.v [res = 8 [limit = 32 [lock = 0]]]
  9. ;         
  10. ;    seed is the complex constant c (v imaginary)
  11. ;    res is the number of pixels on a side for the point to plot 
  12. ;    limit is the max number of iterations (best between 16 & 128, multiple of 4),
  13. ;    lower limit means most complex regions of the fractal are white
  14. ;    if lock is 0, pressing the mouse will immediately stop the drawing, otherwise
  15. ;    pressing the mouse has no effect and drawing can only be stopped by reboot or
  16. ;    fancy macsbug work.
  17. ;   
  18. ;    Doug Felt, AIR/CAT Project
  19. ;    duggie@jessica.stanford.edu
  20. ;
  21. ;    
  22. ;    To compile and link in MPW C:
  23. ;
  24. ;    C -q2 Fractal.c
  25. ;    link -sn Main=Fractal -sn STDIO=Fractal ∂
  26. ;         -sn INTENV=Fractal -rt XCMD=104 ∂
  27. ;         -m FRACTAL Fractal.c.o "{CLibraries}CRunTime.o" ∂
  28. ;         -o HyperCommands
  29. ;
  30. ;
  31. ;
  32. ;    Fractal3 xcmd v3.0 -- Ray Sanders, Nov 7, 1987
  33. ;
  34. ;        Well now, I thought this was so neat, and Doug was right it needs a 
  35. ;    little more speed. So thats what I did, I rewrote the "C" program in 
  36. ;    assembler with direct processing on the MC68881 FPU. I think this makes
  37. ;    quite a difference. The only thing is that it only runs on a MacII. It
  38. ;    might run on one or more of the accelerator cards. Give it a try. If 
  39. ;    necessary, change the COID= parameter below if they are using other than 1.
  40. ;
  41. ;                    Ray Sanders
  42. ;                Green Grass Software, Inc.
  43. ;
  44. ;            CIS: 70277,3233     GEnie: RAYSANDERS
  45. ;
  46. ;    To assemble and link with MPW:
  47. ;
  48. ;                fractal3.a.o ƒ fractal3.make fractal3.a
  49. ;                    Asm fractal3.a -l -font Monaco,9
  50. ;                fractal3 ƒ fractal3.make fractal3.a.o
  51. ;                    link -o fractal3 -rt XCMD=106 -sn Main=Fractal3 -t STAK -c WILD ∂
  52. ;                        fractal3.a.o ∂
  53. ;                        -o "Fractals"
  54. ;
  55. ;
  56. ;
  57. ;    Fractal5 -- Ray Sanders, Nov 15, 1987
  58. ;
  59. ;        OK, so HyperCard was a trip. But when you have to run it on the Mac II
  60. ;    you might as well have the color. And we do.
  61. ;
  62. ;                    Ray Sanders
  63. ;                Green Grass Software, Inc.
  64. ;
  65. ;            CIS: 70277,3233     GEnie: RAYSANDERS
  66. ;
  67. ;    To assemble and link with MPW:
  68. ;
  69. ;        #   Target:     fractal5
  70. ;        #   Sources:    fractal5.a fractal5.r
  71. ;        #   Created:    Saturday, November 14, 1987 11:26:53 PM
  72. ;        
  73. ;        fractal5.a.o ƒ fractal5.make fractal5.a
  74. ;            Asm fractal5.a -font Monaco,9
  75. ;        fractal5 ƒƒ fractal5.make fractal5.r
  76. ;            Rez fractal5.r -append -o fractal5
  77. ;        fractal5 ƒƒ fractal5.make fractal5.a.o
  78. ;            Link -w -t APPL -c '????' ∂
  79. ;                fractal5.a.o ∂
  80. ;                "{Libraries}"Interface.o ∂
  81. ;                "{Libraries}"Runtime.o ∂
  82. ;                -o fractal5
  83. ;
  84. ;
  85.  
  86.  
  87. ;         INCLUDE        'Traps.a'
  88. ;         INCLUDE        'SysEqu.a'
  89. ;         INCLUDE        'QuickEqu.a'
  90. ;         INCLUDE        'ToolEqu.a'
  91. ;         INCLUDE        'PaletteEqu.a'
  92.         PRINT        OFF
  93.          INCLUDE        'Traps.a'
  94.          INCLUDE        'SysEqu.a'
  95.          INCLUDE        'QuickEqu.a'
  96.          INCLUDE        'ToolEqu.a'
  97.          INCLUDE        'PaletteEqu.a'
  98.         PRINT        ON,NOWARN
  99. ;        PRINT        ON
  100.  
  101.                 BLANKS            OFF     ; allow comments without semicolons
  102.  
  103. Point            RECORD            0            Point = RECORD CASE INTEGER OF
  104. v                DS.W            1                      1: (v: INTEGER;
  105. h                DS.W            1                          h: INTEGER);
  106.                 ORG             v                      2: (vh: ARRAY[1..2]
  107. vh                DS.W            h                                 OF INTEGER)
  108.                 ENDR                                END;
  109.  
  110. Rect            RECORD            0            Rect  = RECORD CASE INTEGER OF
  111. top             DS.W            1                      1: (top:      INTEGER;
  112. left            DS.W            1                          left:   INTEGER;
  113. bottom            DS.W            1                          bottom: INTEGER;
  114. right            DS.W            1                          right:  INTEGER);
  115.                 ORG             top
  116. topLeft         DS.L            Point                  2:  (topLeft:  Point;
  117. botRight        DS.L            Point                  3:  (botRight: Point)
  118.                 ENDR                                END;
  119.  
  120. BitMap            RECORD            0            BitMap = RECORD
  121. baseAddr        DS.L            1                      baseAddr: QDPtr;
  122. rowBytes        DS.W            1                      rowBytes: INTEGER;
  123. bounds            DS.L            Rect                  bounds:     Rect
  124.                 ENDR                                END;
  125.  
  126. EventRecord     RECORD            0            EventRecord = RECORD
  127. what            DS.W            1                      what:    INTEGER;
  128. message         DS.L            1                      message:     LONGINT;
  129. when            DS.L            1                      when:    LONGINT;
  130. where            DS.L            Point                  where:       Point;
  131. modifiers        DS.W            1                      modifiers: INTEGER
  132.                 ENDR                                END;
  133.  
  134.                 EJECT
  135.  
  136. ***********************
  137. * QuickDraw's Globals *
  138. ***********************
  139.  
  140. * The following data module is used to define the QuickDraw global data area.
  141. *                -----------
  142.  
  143. QuickDraw        RECORD            ,DECREMENT
  144. thePort         DS.L            1
  145. white            DS.B            8
  146. black            DS.B            8
  147. gray            DS.B            8
  148. ltGray            DS.B            8
  149. dkGray            DS.B            8
  150. arrow            DS.B            cursRec
  151. screenBits        DS.B            BitMap
  152. randSeed        DS.L            1
  153.                 ORG             -grafSize
  154.                 ENDR
  155.  
  156. fractal5    MAIN
  157.         
  158.         BLANKS        ON
  159.         STRING        ASIS
  160.         MC68881        COID=1,PREC=X,ROUND=N
  161.  
  162. true    EQU            1
  163.  
  164. ; definition of stack frame
  165.  
  166. stackStor    RECORD    0,DECREMENT
  167. stackStorStart    EQU        *
  168. hsize            DS.W    1
  169. vsize            DS.W    1
  170. i                DS.W    1
  171. j                DS.W    1
  172. iter            DS.W    1
  173. rbaseh            DS.W    1
  174. rat                DS.L    3
  175. valh            DS.L    3
  176. valv            DS.L    3
  177. temp            DS.L    3
  178. basev            DS.L    3
  179. baseh            DS.L    3
  180. hsq                DS.L    3
  181. vsq                DS.L    3
  182. real100            DS.L    3
  183. fake256            DS.L    1
  184. fake171            DS.L    1
  185. fake2            DS.L    1
  186. fake100            DS.L    1
  187. r                DS.W    4
  188. tempX            DS.L    3
  189. tempBig            DS.B    520
  190. tempBig2        DS.B    520
  191. tempL            DS.L    1
  192. srcBM            DS.W    7
  193. dstR            DS.W    4
  194. CurPort            DS.L    1
  195. ourWindPtr        DS.L    1
  196. ourPixMap        DS.L    1
  197. watchCursorHand    DS.L    1
  198. ourDlogPtr        DS.L    1
  199. itemHitInt        DS.W    1
  200. dummyRect        DS.W    4
  201. itemHandle        DS.L    1
  202. dummyType        DS.W    1
  203. packedData        DS.L    3
  204. seedH            DS.L    3
  205. seedV            DS.L    3
  206. limit            DS.W    1
  207. evtRecd            DS.L    4
  208. stackStorLen    EQU     *-stackStorStart 
  209.             ENDR
  210.  
  211.             WITH stackStor,QuickDraw
  212. EntryPoint
  213. ;;;        _Debugger                            ;
  214.         MOVEM.L    A0-A6/D0-D7,-(SP)            ;
  215.         LINK    A6,#stackStorLen            ;
  216.     
  217.         PEA     thePort                     ; Initialize QuickDraw
  218.         _InitGraf
  219.         _InitFonts                            ; Initialize Font Manager
  220.         MOVE.L    #$0000FFFF,D0                ; Discard any previous events
  221.         _FlushEvents                        ; FlushEvents(EventEvent, 0);
  222.         _InitWindows                        ; Initialize Window Manager
  223.         _InitMenus                            ; Initialize Menu Manager
  224.         _TEInit                             ; Initialize TextEdit
  225.         CLR.L    -(A7)                        ; Initialize Dialog Manager
  226.         _InitDialogs                        ; InitDialogs(NIL);
  227.         _InitCursor                         ; Make cursor an arrow
  228.         _InitPalettes                        ; crank up pallette manager
  229.         
  230. ;                                            ; res = 1
  231.         
  232. ;                                            ; limit = 64
  233.         
  234. ;                                            ; nolock = 1
  235.  
  236. ;;;        _Debugger
  237.  
  238.         CLR.L    -(SP)                        ; result
  239.         MOVE.W    #4,-(SP)                    ; cursor type
  240.         _GetCursor                            ; get handle to it
  241.         MOVE.L    (SP)+,watchCursorHand(A6)    ; and save it
  242.  
  243.         CLR.L    -(SP)                        ; result
  244.         MOVE.L    #'scrn',-(SP)                ; resource type
  245.         MOVE.W    #0,-(SP)                    ; resource #
  246.         _GetResource                        ; get screen resource
  247.         MOVE.L    (SP)+,A0                    ; get resource handle
  248.         MOVE.L    (A0),A0                        ; de-ref it
  249.         MOVE.W    (A0)+,D0                    ; count of screens
  250. @010
  251.         BTST.B    #3,12(A0)                    ; is this the main screen ?
  252.         BNE.S    @040                        ; yes
  253.         ADDA.L    #26,A0                        ; pt to ctl call field
  254.         MOVE.W    (A0)+,D1                    ; get count of ctl calls
  255.         BEQ.S    @030                        ; none
  256. @020
  257.         ADDQ.L    #8,A0                        ; skip ctl call
  258.         SUBQ.W    #1,D1                        ; sub 1 from count
  259.         BNE.S    @020                        ; more
  260. @030
  261.         SUBQ.W    #1,D0                        ; sub 1 from count
  262.         BNE.S    @010                        ; more
  263.         BRA        FracsDone                    ; could not find main screen
  264. @040
  265.         CMPI.W    #130,8(A0)                    ; 16 colors ?
  266.         BEQ.S    @050                        ; yes
  267.         CMPI.W    #131,8(A0)                    ; 256 colors ?
  268.         BEQ.S    @050                        ; yes
  269.  
  270.         CLR.W    -(SP)                        ; result
  271.         MOVE.W    #128,-(SP)                    ; 'ALRT' id
  272.         CLR.L    -(SP)                        ; no filter proc
  273.         _StopAlert                            ; tell why were not running
  274.         ADDQ.L    #2,SP                        ; don't care
  275.         BRA        FracsDone                    ; not enough colors
  276. @050
  277.  
  278.         CLR.L    -(SP)                        ; DialogPtr
  279.         MOVE.W    #130,-(SP)                    ; dialogID
  280.         CLR.L    -(SP)                        ; dStorage
  281.         MOVE.L    #-1,-(SP)                    ; behind
  282.         _GetNewDialog                        ;
  283.         MOVE.L    (SP)+,ourDlogPtr(A6)        ;
  284.         
  285.         MOVE.L    ourDlogPtr(A6),-(SP)        ; DialogPtr
  286.         _SetPort                            ;
  287.         
  288.         MOVE.L    ourDlogPtr(A6),-(SP)        ; DialogPtr
  289.         MOVE.W    #1,-(SP)                    ; itemNo
  290.         PEA.L    dummyType(A6)                ; VAR itemType
  291.         PEA.L    itemHandle(A6)                ; VAR item
  292.         PEA.L    dummyRect(A6)                ; VAR itemRect
  293.         _GetDItem                            ;
  294.         
  295.         MOVE.L    #$00030003,-(SP)            ; v & h
  296.         _PenSize                            ;
  297.         PEA.L    dummyRect(A6)                ;
  298.         MOVE.L    #$FFFCFFFC,-(SP)            ; V & H
  299.         _InsetRect                            ;
  300.         PEA.L    dummyRect(A6)                ;
  301.         MOVE.L    #$00100010,-(SP)            ; V & H
  302.         _FrameRoundRect                        ;
  303.  
  304.         MOVE.W    #3,D0                        ;
  305. @055
  306.         MOVE.L    ourDlogPtr(A6),-(SP)        ; DialogPtr
  307.         MOVE.W    D0,-(SP)                    ; itemNo
  308.         MOVE.W    #0,-(SP)                    ; strtSel
  309.         MOVE.W    #32767,-(SP)                ; endSel
  310.         _SelIText
  311.         
  312.         CLR.L    -(SP)                        ; filterProc
  313.         PEA.L    itemHitInt(A6)                ; VAR itemHit
  314.         _ModalDialog                        ;
  315.         CMPI.W    #1,itemHitInt(A6)            ;
  316.         BEQ.S    @060                        ;
  317.  
  318.         MOVE.L    ourDlogPtr(A6),-(SP)        ;
  319.         _DisposDialog                        ;
  320.  
  321.         BRA        FracsDone                    ;
  322.  
  323. @060
  324.         MOVE.W    #3,D0                        ;
  325.         BSR        GetFieldRtn                    ;
  326.         BSR        ConvertFieldRtn                ;
  327.         BEQ        @065                        ;
  328.         MOVE.W    #3,D0                        ;
  329.         BRA.S    @055                        ;
  330. @065
  331.         FMOVE.X    FP0,seedH(A6)                ; get result
  332.         
  333.         MOVE.W    #4,D0                        ;
  334.         BSR        GetFieldRtn                    ;
  335.         BSR        ConvertFieldRtn                ;
  336.         BEQ        @070                        ;
  337.         MOVE.W    #4,D0                        ;
  338.         BRA.S    @055                        ;
  339. @070
  340.         FMOVE.X    FP0,seedV(A6)                ;
  341.         
  342.         MOVE.W    #5,D0                        ;
  343.         BSR        GetFieldRtn                    ;
  344.         BSR        ConvertFieldRtn                ;
  345.         BEQ        @075                        ;
  346.         MOVE.W    #5,D0                        ;
  347.         BRA.S    @055                        ;
  348. @075
  349.         FMOVE.W    FP0,limit(A6)                ;
  350.         
  351.         MOVE.L    ourDlogPtr(A6),-(SP)        ;
  352.         _DisposDialog                        ;
  353.         
  354. @100
  355.         CLR.L    -(SP)                        ; WindowPtr
  356.         CLR.L    -(SP)                        ; wStorage
  357.         PEA.L    bRect                        ; boundsRect
  358.         PEA.L    wTitle                        ; wTitle
  359.         MOVE.B    #true,-(SP)                    ; visible
  360.         MOVE.W    #noGrowDocProc,-(SP)        ; procID
  361.         MOVE.L    #-1,-(SP)                    ; behind
  362.         MOVE.B    #true,-(SP)                    ; goAwayFlag
  363.         CLR.L    -(SP)                        ; refCon
  364.         _NewCWindow                            ;
  365.         MOVE.L    (SP),ourWindPtr(A6)            ;
  366.         _SetPort                            ;
  367.  
  368.         CLR.L    -(SP)                        ; PixMapHandle
  369.         _NewPixMap                            ;
  370.         MOVE.L    (SP)+,ourPixMap(A6)            ;
  371.         
  372.         MOVE.L    ourWindPtr(A6),A0            ;
  373.         MOVE.L    portPixMap(A0),-(SP)        ; get handle to cGrafPort pix map
  374.         MOVE.L    ourPixMap(A6),-(SP)            ; our pix map
  375.         _CopyPixMap                            ; copy (to get color table)
  376.         
  377.         MOVE.L    ourPixMap(A6),A0            ; get handle
  378.         MOVE.L    (A0),A0                        ; de-ref it
  379.         MOVE.L    pmTable(A0),-(SP)            ; get c-tab handle
  380.         _DisposCTable                        ; release prev table
  381.  
  382.         CLR.L    -(SP)                        ; result
  383.         MOVE.W    #128,-(SP)                    ; 'clut' ID number
  384.         _GetCTable                            ; get our table
  385.         MOVE.L    (SP),A0                        ; our tables new handle
  386.         MOVE.L    A0,-(SP)                    ; resource to detach
  387.         _DetachResource                        ; disco it
  388.         
  389.         MOVE.L    ourPixMap(A6),A0            ; get handle
  390.         MOVE.L    (A0),A0                        ; de-ref it
  391.         MOVE.L    (SP)+,pmTable(A0)            ; set new table        
  392.  
  393.         MOVE.L    watchCursorHand(A6),A0        ; handle
  394.         _HLock                                ; hang on to it
  395.         
  396.         MOVE.L    watchCursorHand(A6),A0        ; handle
  397.         MOVE.L    (A0),-(SP)                    ; ptr
  398.         _SetCursor                            ; let's do the wait thing
  399.         
  400.         MOVE.L    watchCursorHand(A6),A0        ; handle
  401.         _HUnlock                            ; free it
  402.  
  403. ;    /* map screen onto -2 to 2 range */
  404. ;    
  405. ;    /* 0,0 is at 512/2, 342/2 = 256,171 */
  406. ;    
  407. ;    /* gridding to res requires that I find out how many boxes wide and tall
  408. ;       the image is, and map each box onto a value in r2.  then i iterate over
  409. ;       all the boxes calling the function until the x or y exceeds some limit.
  410. ;       then i map the number of iterations into a 'color' */
  411. ;       
  412. ;    /* since we don't have a global data area for extended constants to live in,
  413. ;       use longs and fake the compiler into making the correct SANE calls to 
  414. ;       build the extended values.  Is there a better way (besides using Pascal!) */
  415. ;
  416.  
  417.         CLR.L    D0                            ;
  418.         MOVE.W    bRect+6,D0                    ; get right
  419.         SUB.W    bRect+2,D0                    ; sub left
  420.         ADDQ.W    #1,D0                        ;
  421.         LSR.L    #1,D0                        ; divide by 2
  422.         MOVE.L    D0,fake256(A6)                ;
  423.         
  424.         CLR.L    D0                            ;
  425.         MOVE.W    bRect+4,D0                    ; get bottom
  426.         SUB.W    bRect,D0                    ; sub top
  427.         ADDQ.W    #1,D0                        ;
  428.         LSR.L    #1,D0                        ; divide by 2
  429.         MOVE.L    D0,fake171(A6)                ;
  430.         
  431.         MOVE.L    #2,fake2(A6)                ; fake2 = 2
  432.         
  433.         MOVE.L    #100,fake100(A6)            ; fake100 = 100
  434.  
  435.         MOVE.L    fake256(A6),D0                ; hsize = (fake256/res)+1
  436.         DIVS.W    res,D0                        ;
  437.         ADDQ.W    #1,D0                        ;
  438.         MOVE.W    D0,hsize(A6)                ;
  439.         
  440.         MOVE.L    fake171(A6),D0                ; vsize = (fake171/res)+1
  441.         DIVS.W    res,D0                        ;
  442.         ADDQ.W    #1,D0                        ;
  443.         MOVE.W    D0,vsize(A6)                ;
  444.         
  445.         FMOVECR.X #$34,FP0                    ; real100 = fake100
  446.         FMOVE.X    FP0,real100(A6)                ;
  447.         
  448. ;                                            ; real2 = fake2
  449.         
  450. ;                                            ; realn2 = -fake2
  451.         
  452.         FMOVE.X    real2,FP0                    ; rat = real2/hsize
  453.         FDIV.W    hsize(A6),FP0                ;
  454.         FMOVE.X    FP0,rat(A6)                    ; /* reals intermediate result because of real2 */
  455.         
  456.         MOVE.W    res,D0                        ; rbaseh = 256-hsize*res
  457.         MULS.W    hsize(A6),D0                ;
  458.         MOVE.L    fake256(A6),D1                ;
  459.         SUB.W    D0,D1                        ;
  460.         MOVE.W    D1,rbaseh(A6)                ;
  461.         
  462.         MOVE.W    res,D0                        ; r.top = 171-vsize*res
  463.         MULS.W    vsize(A6),D0                ;
  464.         MOVE.L    fake171(A6),D1                ;
  465.         SUB.W    D0,D1                        ;
  466.         MOVE.W    D1,r(A6)                    ;
  467.         
  468.         ADD.W    res,D1                        ; r.bottom = r.top + res
  469.         MOVE.W    D1,r+4(A6)                    ;
  470.         
  471.         FMOVE.L    fake171(A6),FP2                ; basev = realn2*fake171/fake256
  472.         FMUL.X    realn2,FP2                    ; /* center it */
  473.         FDIV.L    fake256(A6),FP2                ;
  474.         
  475.         FMOVE.X    seedv(A6),FP0                ;
  476.         FMOVE.X    seedh(A6),FP1                ;
  477.  
  478. ;            for loop
  479.         
  480.         MOVE.W    vsize(A6),D4                ; for (i=-vsize; i<vsize; ++i)
  481.         NEG.W    D4                            ;
  482. @200
  483. ;;;        CMP.W    vsize(A6),D4                ;
  484.         CMPI.W    #0,D4                        ;
  485.         BGE        @502                        ;
  486.         
  487.         MOVE.W    rbaseh(A6),D0                ; r.left = rbaseh
  488.         MOVE.W    D0,r+2(A6)                    ;
  489.         
  490.         ADD.W    res,D0                        ; r.right = r.left + res
  491.         MOVE.W    D0,r+6(A6)                    ;
  492.         
  493.         CLR.W    -(SP)                        ; check if this line is visible
  494.         MOVE.L    r(A6),-(SP)                    ;
  495.         MOVE.L    ourWindPtr(A6),A0            ;
  496.         MOVE.L    contRgn(A0),-(SP)            ;
  497.         _PtInRgn                            ;
  498.         TST.W    (SP)+                        ;
  499.         BNE        @470                        ;
  500.         
  501.         FMOVE.X    realn2,FP3                    ; baseh = realn2
  502.         
  503. ;            for loop
  504.  
  505.         MOVE.W    hsize(A6),D3                ; for (j=-hsize; j<hsize; ++j)
  506.         NEG.W    D3                            ;
  507. @250
  508.         CMP.W    hsize(A6),D3                ;
  509.         BGT        @450                        ;
  510.         
  511.         FMOVE.X    FP3,FP5                        ; valh = baseh
  512.         
  513.         FMOVE.X    FP2,FP4                        ; valv = basev
  514.         
  515.         CLR.W    D5                            ; iter = 0
  516.         
  517. ;            do loop
  518.  
  519. @300
  520. ;
  521. ;
  522. ;    register assignments to speed up loop
  523. ;
  524. ;        hsq is in FP7
  525. ;        vsq is in FP6
  526. ;        valh is in FP5
  527. ;        valv is in FP4
  528. ;        baseh is in FP3
  529. ;        basev is in FP2
  530. ;        seedh is in FP1
  531. ;        seedv is in FP0
  532. ;
  533.         
  534.         FMOVE.X    FP4,FP6                        ; vsq = valv * valv
  535.         FMUL.X    FP4,FP6                        ;
  536.         
  537.         FMUL.X    FP5,FP4                        ; valv = real2*valh*valv + seedv
  538.         FADD.X    FP4,FP4                        ;
  539.         FADD.X    FP0,FP4                        ;
  540.         
  541.         FMUL.X    FP5,FP5                        ; hsq = valh * valh
  542.         FMOVE.X    FP5,FP7                        ;
  543.         
  544.         FSUB.X    FP6,FP5                        ; valh = hsq - vsq + seedh
  545.         FADD.X    FP1,FP5                        ;
  546.         
  547.         ADDQ.W    #1,D5                        ; ++iter
  548.         
  549.         FADD.X    FP6,FP7                        ; while ((hsq+vsq<real100) && (iter<limit))
  550.         FMOVE.X    sCons,FP6                    ; <<<<< this one brings in a constant from 68020
  551. ;;;        FMOVECR.X #$34,FP6                    ; <<<<< this one uses X'100.0' from 68881 ROM
  552.         FCMP.X    FP7,FP6                        ;
  553.         FBLE.W    @350                        ;
  554.         CMP.W    limit(A6),D5                ;
  555.         BLE        @300                        ;
  556.  
  557. @350
  558.         FADD.X    rat(A6),FP3                    ; baseh += rat
  559.         
  560.         MOVE.W    r+2(A6),D2                    ; get left pixel #
  561.         SUB.W    rbaseh(A6),D2                ; make rel to zero
  562.         ANDI.W    #-8,D2                        ; got long word #
  563.         LSR.W    #1,D2                        ; divide by 2 ( get's displ)
  564.         LEA.L    tempBig(A6),A1                ; get base
  565.         ADDA.W    D2,A1                        ; pt to line
  566.  
  567.         ANDI.L    #15,D5                        ;
  568.  
  569.         MOVE.W    r+2(A6),D0                    ; get left pixel #
  570.         SUB.W    rbaseh(A6),D0                ; make rel to zero
  571.         MOVEQ.L    #7,D2                        ;
  572.         AND.W    D2,D0                        ; take mod 4
  573.         BNE.S    @447                        ; no
  574.         CLR.L    (A1)                        ; clear the word
  575. @447
  576.         SUB.W    D0,D2                        ;
  577.         CLR.L    D0                            ;
  578.         LSL.W    #2,D2                        ; mult by 4
  579.         LSL.L    D2,D5
  580.         OR.L    D5,(A1)                        ; set pixel relative value
  581.  
  582.         MOVE.W    res,D0                        ; r.left += res
  583.         ADD.W    D0,r+2(A6)                    ;
  584.         
  585.         ADD.W    D0,r+6(A6)                    ; r.right += res
  586.         
  587.         ADDQ.W    #1,D3                        ;
  588.         BRA        @250                        ;
  589.  
  590. @450
  591. ;;;        _Debugger
  592.         FADD.X    rat(A6),FP2                    ; basev += rat
  593.  
  594.         MOVE.L    ourPixMap(A6),A2            ; get pixMap handle
  595.         MOVE.L    (A2),A2                        ; de-ref it
  596.         LEA.L    tempBig(A6),A0                ; pt to bit area
  597.         MOVE.L    A0,pmBaseAddr(A2)            ; set it
  598.         MOVE.W    #512,pmRowBytes(A2)            ; set rowBytes
  599.         ORI.B    #$80,pmNewFlag(A2)            ; indicate new pix map
  600.         MOVE.W    #4,pmPixelSize(A2)            ; set bits per pixel
  601.         MOVE.W    #4,pmCmpSize(A2)            ; set bits per pixel
  602.  
  603.         MOVE.W    #0,dstR+2(A6)                ; set left
  604.         MOVE.W    bRect+6,D0                    ; get right
  605.         SUB.W    bRect+2,D0                    ; find diff
  606.         MOVE.W    D0,dstR+6(A6)                ; set right
  607.         MOVE.W    r(A6),D0                    ; get top
  608.         MOVE.W    D0,dstR(A6)                    ; set top
  609.         ADD.W    #1,D0                        ;
  610.         MOVE.W    D0,dstR+4(A6)                ; set bottom
  611.  
  612.         MOVE.L    dstR(A6),pmBounds(A2)        ;
  613.         MOVE.L    dstR+4(A6),pmBounds+4(A2)    ;
  614.  
  615.         MOVE.L    ourPixMap(A6),A0            ;
  616.         MOVE.L    (A0),-(SP)                    ;
  617.         MOVE.L    ourWindPtr(A6),A0            ; get ptr to port
  618.         MOVE.L    portPixMap(A0),A0            ; dest bitmap
  619.         MOVE.L    (A0),-(SP)                    ;
  620.         PEA.L    dstR(A6)                    ;
  621.         PEA.L    dstR(A6)                    ;
  622.         MOVE.W    #srcCopy,-(SP)                ;
  623.         CLR.L    -(SP)                        ;
  624.         _CopyBits
  625. @460
  626.         CLR.L    D6                            ;
  627.         MOVE.W    bRect+6,D6                    ; get right
  628.         SUB.W    bRect+2,D6                    ; find diff
  629.         ADDQ.L    #2,D6                        ;
  630.         CLR.L    D7                            ;
  631.         MOVE.L    D6,D0                        ;
  632.         ANDI.L    #-8,D0                        ;
  633.         LSR.L    #1,D0                        ;
  634.         LEA.L    tempBig2(A6),A0                ;
  635.         ADDA.L    D0,A0                        ; pt to recv word
  636.         CLR.L    (A0)                        ;
  637. @462                                        ;
  638.         LEA.L    tempBig(A6),A0                ;
  639.         MOVE.L    D7,D0                        ;
  640.         ANDI.L    #-8,D0                        ;
  641.         LSR.L    #1,D0                        ;
  642.         ADDA.L    D0,A0                        ;
  643.         MOVE.L    D7,D0                        ;
  644.         ANDI.L    #7,D0                        ;
  645.         LSL.L    #2,D0                        ;
  646.         MOVE.L    (A0),D1                        ;
  647.         LSL.L    D0,D1                        ;
  648.         ANDI.L    #$F0000000,D1                ; save our nible
  649.         MOVE.L    D6,D0                        ;
  650.         SUB.L    D7,D0                        ;
  651.         MOVE.L    D0,D2                        ; make a copy
  652.         ANDI.L    #-8,D0                        ;
  653.         LSR.L    #1,D0                        ;
  654.         LEA.L    tempBig2(A6),A0                ;
  655.         ADDA.L    D0,A0                        ; pt to recv word
  656.         ANDI.L    #7,D2                        ;
  657.         CMPI.L    #7,D2                        ;
  658.         BNE.S    @464                        ;
  659.         CLR.L    (A0)                        ;
  660. @464                                        ;
  661.         LSL.L    #2,D2                        ;
  662.         LSR.L    D2,D1                        ;
  663.         OR.L    D1,(A0)                        ;
  664.         CMP.W    D6,D7                        ;
  665.         BGT.S    @466                        ;
  666.         ADDQ.L    #1,D7                        ;
  667.         BRA        @462                        ;
  668. @466
  669.         MOVE.L    ourPixMap(A6),A2            ; get pixMap handle
  670.         MOVE.L    (A2),A2                        ; de-ref it
  671.         LEA.L    tempBig2(A6),A0                ; pt to bit area
  672.         MOVE.L    A0,pmBaseAddr(A2)            ; set it
  673.  
  674.         MOVE.W    bRect+4,D1                    ; get bottom
  675.         SUB.W    bRect,D1                    ; find diff
  676.         SUB.W    r(A6),D1                    ; get top
  677.         MOVE.W    D1,dstR(A6)                    ; set top
  678.         ADD.W    #1,D1                        ;
  679.         MOVE.W    D1,dstR+4(A6)                ; set bottom
  680.  
  681.         MOVE.L    dstR(A6),pmBounds(A2)        ;
  682.         MOVE.L    dstR+4(A6),pmBounds+4(A2)    ;
  683.  
  684.         MOVE.L    ourPixMap(A6),A0            ;
  685.         MOVE.L    (A0),-(SP)                    ;
  686.         MOVE.L    ourWindPtr(A6),A0            ; get ptr to port
  687.         MOVE.L    portPixMap(A0),A0            ; dest bitmap
  688.         MOVE.L    (A0),-(SP)                    ;
  689.         PEA.L    dstR(A6)                    ;
  690.         PEA.L    dstR(A6)                    ;
  691.         MOVE.W    #srcCopy,-(SP)                ;
  692.         CLR.L    -(SP)                        ;
  693.         _CopyBits
  694.         
  695. @470
  696.         MOVE.W    res,D0                        ; r.top += res
  697.         ADD.W    D0,r(A6)                    ;
  698.         
  699.         ADD.W    D0,r+4(A6)                    ; r.bottom += res
  700.         
  701.         SUBQ.L    #2,SP                        ; result
  702.         MOVE.W    #$2a,-(SP)                    ; eventMask
  703.         PEA.L    evtRecd(A6)                    ; VAR theEvent
  704.         _GetNextEvent                        ;
  705.         TST.B    (SP)+                        ; any event ?
  706.         BNE        PitchWindow                    ; yes
  707. @475
  708.         
  709.         ADDQ.W    #1,D4                        ;
  710.         BRA        @200                        ;
  711.  
  712. @502
  713.         SUBQ.L    #2,SP                        ; result
  714.         MOVE.W    #$2a,-(SP)                    ; eventMask
  715.         PEA.L    evtRecd(A6)                    ; VAR theEvent
  716.         _GetNextEvent                        ;
  717.         TST.B    (SP)+                        ; any event ?
  718.         BEQ        @502                        ; yes
  719. PitchWindow
  720.         MOVE.L    ourWindPtr(A6),-(SP)        ;
  721.         _DisposWindow                        ; get rid of it
  722. FracsDone
  723.         _InitCursor
  724.  
  725.         CLR.L    -(SP)                        ; result
  726.         MOVE.W    #129,-(SP)                    ; dlog ID
  727.         CLR.L    -(SP)                        ; dStorage
  728.         MOVE.L    #-1,-(SP)                    ; behind
  729.         _GetNewDialog                        ; show it
  730.         MOVE.L    (SP),-(SP)                    ; copy it
  731.         _DrawDialog                            ; and draw it
  732.         
  733.         MOVE.L    #60,A0                        ; numticks
  734.         _Delay
  735.         
  736.         _DisposDialog                        ;
  737.         
  738.         UNLK    A6
  739.         MOVEM.L    (SP)+,A0-A6/D0-D7        ; restore registers
  740.         _ExitToShell
  741.  
  742. GetFieldRtn
  743.         MOVE.L    ourDlogPtr(A6),-(SP)        ; DialogPtr
  744.         MOVE.W    D0,-(SP)                    ; itemNo
  745.         PEA.L    dummyType(A6)                ; VAR itemType
  746.         PEA.L    itemHandle(A6)                ; VAR item
  747.         PEA.L    dummyRect(A6)                ; VAR itemRect
  748.         _GetDItem                            ;
  749.         
  750.         MOVE.L    itemHandle(A6),-(SP)        ; item
  751.         PEA.L    tempBig(A6)                    ; VAR text
  752.         _GetIText                            ;
  753.         
  754.         RTS                                    ;
  755.         
  756. ConvertFieldRtn
  757.         CMP.B    #10,tempBig(A6)                ;
  758.         BGT        @850                        ;
  759.         CLR.L    D7                            ; clear sign reg
  760.         
  761.         LEA.L    tempBig(A6),A0                ;
  762.         CLR.L    D0                            ;
  763.         MOVE.L    #-1,D1                        ;
  764.         CLR.L    D2                            ;
  765.         MOVE.B    (A0)+,D2                    ; get string length
  766.         CLR.L    D3                            ;
  767.         
  768.         CMPI.B    #'-',(A0)                    ; do we start with a neg ?
  769.         BNE.S    @100                        ; no
  770.         MOVE.L    #$80000000,D7                ; mask for later or'ing
  771.         ADDQ.L    #1,A0                        ;
  772.         SUBQ.L    #1,D2                        ;
  773. @100
  774.         CMPI.B    #'.',(A0)                    ; seperator ?
  775.         BEQ        @190                        ; yes
  776.         CMPI.B    #$30,(A0)                    ; check nums
  777.         BLT        @850                        ; bad
  778.         CMPI.B    #$39,(A0)                    ; check nums
  779.         BGT        @850                        ;
  780.         MOVE.B    (A0)+,D3                    ;
  781.         ANDI.L    #15,D3                        ;
  782.         LSL.L    #4,D0                        ; make room
  783.         OR.L    D3,D0                        ; copy over
  784.         SUBQ.L    #1,D2                        ;
  785.         BNE.S    @100                        ; loop if more
  786.         BRA        @300                        ;
  787.         
  788. @190
  789.         ADDQ.L    #1,A0                        ;
  790.         SUBQ.L    #1,D2                        ;
  791.         BEQ        @300                        ;
  792.         
  793. @200
  794.         CMPI.B    #$30,(A0)                    ; check nums
  795.         BLT        @850                        ; bad
  796.         CMPI.B    #$39,(A0)                    ; check nums
  797.         BGT        @850                        ;
  798.         MOVE.B    (A0)+,D3                    ;
  799.         ANDI.L    #15,D3                        ;
  800.         LSL.L    #4,D1                        ; make room
  801.         OR.L    D3,D1                        ; copy over
  802.         SUBQ.L    #1,D2                        ;
  803.         BNE.S    @200                        ; loop if more
  804.  
  805. @300
  806.         MOVE.L    D1,D3                        ; copy it
  807.         ANDI.L    #$F0000000,D3                ; check upper nibble
  808.         CMPI.L    #$F0000000,D3                ; is it unused ?
  809.         BNE.S    @400                        ; yes
  810.         LSL.L    #4,D1                        ; up it a digit
  811.         BRA.S    @300                        ;
  812.         
  813. @400
  814.         MOVE.L    #$00080000,packedData(A6)    ; set scaling factor
  815.         OR.L    D7,packedData(A6)            ; set sign bit
  816.         MOVE.L    D0,packedData+4(A6)            ;
  817.         MOVE.L    D1,packedData+8(A6)            ;
  818.         FMOVE.P    packedData(A6),FP0            ;
  819.         CLR.L    D2                            ;
  820.         RTS                                    ;
  821. @850
  822.         MOVEQ.L    #-1,D2                        ;
  823.         RTS                                    ;
  824.         
  825.         
  826.         
  827.         
  828. xseedh    DC.X    "0.32"
  829. xseedv    DC.X    "0.043"
  830. ;seedh    DC.X    "0.336"
  831. ;seedv    DC.X    "0.043"
  832. real2    DC.X    "1.0"
  833. realn2    DC.X    "-1.0"
  834. sCons    DC.X    "50.0"
  835. ;bRect    DC.W    50,675,392,1187
  836. ;bRect    DC.W    40,646,475,1274
  837. bRect    DC.W    40,6,475,634
  838. res        DC.W    1
  839. ;limit    DC.W    256
  840. nolock    DC.W    1
  841.  
  842.         STRING    PASCAL
  843. wTitle    DC.B    'Julia Sets v 5.1b0 - by Ray Sanders, Green Grass Software'
  844. byA        DC.B    'Written by Ray Sanders, Green Grass Software Inc.'
  845. byB        DC.B    'P.O.Box 570, Dunedin, Florida 34697-0570'
  846. byC        DC.B    '(813) 796-2272'
  847. blank    DC.B    ' '
  848.             ENDWITH
  849.             ENDMAIN
  850.             END
  851.  
  852.